
package nc.bs.pub.action;

import nc.bs.arap.rule.RongApproveRule;
import nc.bs.framework.common.NCLocator;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.ApproveStatusCheckRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.rongq.rongq.AggRongQVO;
import nccloud.bs.rongq.bill.aggbusi.plugin.bpplugin.RongQVOPluginPoint;
import nccloud.itf.rongq.bill.IRongqvoMaintain;

public class N_RONG_APPROVE extends AbstractPfAction<AggRongQVO> {

        public N_RONG_APPROVE() {
                super();
        }

        @Override
        protected CompareAroundProcesser<AggRongQVO> getCompareAroundProcesserWithRules(
                        Object userObj) {
                CompareAroundProcesser<AggRongQVO> processor = new CompareAroundProcesser<AggRongQVO>(
                                RongQVOPluginPoint.APPROVE);
                processor.addBeforeRule(new ApproveStatusCheckRule());
                processor.addAfterRule(new RongApproveRule());
                return processor;
        }

        @Override
        protected AggRongQVO[] processBP(Object userObj,
                        AggRongQVO[] clientFullVOs, AggRongQVO[] originBills) {
                AggRongQVO[] bills = null;
                IRongqvoMaintain operator = NCLocator.getInstance().lookup(
                                IRongqvoMaintain.class);
                try {
                        bills = operator.approve(clientFullVOs, originBills);
                } catch (BusinessException e) {
                        ExceptionUtils.wrappBusinessException(e.getMessage());
                }
                return bills;
        }

}
